package com.copd.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;

@ApiModel(description = "用户实体")
@Data
public class User {
    @ApiModelProperty(value = "用户ID", example = "1")
    private Integer userId;

    @ApiModelProperty(value = "用户名", required = true, example = "zhangsan")
    private String username;

    @ApiModelProperty(value = "密码", required = true, example = "123456")
    private String password;

    @ApiModelProperty(value = "角色", required = true, example = "doctor", allowableValues = "doctor,admin")
    private String role;

    @ApiModelProperty(value = "联系方式", required = true, example = "13800138000")
    private String contactInfo;

    @ApiModelProperty(value = "创建时间", hidden = true)
    private LocalDateTime createTime;

    // 医生特有字段
    @ApiModelProperty(value = "职称", example = "主任医师")
    private String title;

    @ApiModelProperty(value = "科室", example = "呼吸内科")
    private String department;

    @ApiModelProperty(value = "从业年限", example = "10")
    private Integer yearsOfExperience;

    @ApiModelProperty(value = "资质认证", example = "执业医师资格证,呼吸内科专科医师资格证")
    private String certification;

    public static int generateRandomUserId() {
        // 生成6-8位随机数
        int min = 100000;  // 6位数的最小值
        int max = 99999999;  // 8位数的最大值
        return min + (int)(Math.random() * ((max - min) + 1));
    }
}